﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Starfire3d.Managers
{
    public static class MovementManager
    {
        private static int movementPulse = 0;

        public static void NewMovementPulse()
        {
            ++movementPulse;
        }

        public static bool CanMove(int speed)
        {
            // P : 1 2 3 4 5 6  7  8  9
            // 1 : - - 1 1 1 1  1  1  12
            // 2 : - 1 - 2 2 2  2  23 3
            // 3 : 1 - 2 - 3 3  34 4  45
            // 4 : - 2 - 3 4 4  5  56 6
            // 5 : - - 3 4 5 5  6  7  78
            // 6 : - - - - - 6  7  8  9
            int pulse = (movementPulse % 6) + 1;
           // int multi = speed / 6;

            switch (pulse)
            {
                case 1: { if (speed >= 3) return true; }
                    break;
                case 2: { if (speed == 2 || speed >= 4) return true; }
                    break;
                case 3: { if (speed == 1 || speed == 3 || speed >= 5) return true; }
                    break;
                case 4: { if (speed == 2 || speed >= 4) return true; }
                    break;
                case 5: { if (speed >= 3) return true; }
                    break;
                case 6: { if (speed == 6) return true; }
                    break;
            }

            return false;
        }
    }
}
